import java.util.Arrays;

public class demo11 {
    public static void main(String[] args) {
        int[] a = new int[]{2, 9, 5, 0, 1, 3, 6, 8};
        for (int i = 1; i < a.length; i++) {
            int j =i-1;
            int k = a[i];
            while(j>=0&& k<a[j]){
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = k;
        }
        System.out.println(Arrays.toString(a));
    }
}
